﻿Imports Microsoft.VisualStudio.TestTools.UnitTesting

Imports Battleship



'''<summary>
'''This is a test class for BattleshipGameGridTest and is intended
'''to contain all BattleshipGameGridTest Unit Tests
'''</summary>
<TestClass()> _
Public Class BattleshipGameGridTest


    Private testContextInstance As TestContext

    '''<summary>
    '''Gets or sets the test context which provides
    '''information about and functionality for the current test run.
    '''</summary>
    Public Property TestContext() As TestContext
        Get
            Return testContextInstance
        End Get
        Set(value As TestContext)
            testContextInstance = Value
        End Set
    End Property

#Region "Additional test attributes"
    '
    'You can use the following additional attributes as you write your tests:
    '
    'Use ClassInitialize to run code before running the first test in the class
    '<ClassInitialize()>  _
    'Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
    'End Sub
    '
    'Use ClassCleanup to run code after all tests in a class have run
    '<ClassCleanup()>  _
    'Public Shared Sub MyClassCleanup()
    'End Sub
    '
    'Use TestInitialize to run code before running each test
    '<TestInitialize()>  _
    'Public Sub MyTestInitialize()
    'End Sub
    '
    'Use TestCleanup to run code after each test has run
    '<TestCleanup()>  _
    'Public Sub MyTestCleanup()
    'End Sub
    '
#End Region


    '''<summary>
    '''A test for PlayerNum
    '''</summary>
    <TestMethod()> _
    Public Sub PlayerNumTest()
        Dim PlayerNum As Integer = 1
        Dim IsTrackingGrid As Boolean = True
        Dim IsFiringGrid As Boolean = False
        Dim target As BattleshipGameGrid = New BattleshipGameGrid(PlayerNum, IsTrackingGrid, IsFiringGrid)
        Dim expected As Integer = 1
        Dim actual As Integer
        target.PlayerNum = expected
        actual = target.PlayerNum
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for BattleshipGameGrid Constructor
    '''</summary>
    <TestMethod()> _
    Public Sub BattleshipGameGridConstructorTest()
        Dim PlayerNum As Integer = 1
        Dim IsTrackingGrid As Boolean = True
        Dim IsFiringGrid As Boolean = False
        Dim target As BattleshipGameGrid = New BattleshipGameGrid(PlayerNum, IsTrackingGrid, IsFiringGrid)
        Dim expectedNum As Integer = 1
        Dim expectedTracking As Boolean = True
        Dim expectedFiring As Boolean = False
        Assert.AreEqual(expectedNum, target.PlayerNum)
        Assert.AreEqual(expectedTracking, target.IsTrackingGrid)
        Assert.AreEqual(expectedFiring, target.IsFiringGrid)
    End Sub

    '''<summary>
    '''A test for IsTrackingGrid
    '''</summary>
    <TestMethod()> _
    Public Sub IsTrackingGridTest()
        Dim PlayerNum As Integer = 1
        Dim IsTrackingGrid As Boolean = True
        Dim IsFiringGrid As Boolean = False
        Dim target As BattleshipGameGrid = New BattleshipGameGrid(PlayerNum, IsTrackingGrid, IsFiringGrid)
        Dim expected As Boolean = True
        Dim actual As Boolean
        target.IsTrackingGrid = expected
        actual = target.IsTrackingGrid
        Assert.AreEqual(expected, actual)
    End Sub

    '''<summary>
    '''A test for IsFiringGrid
    '''</summary>
    <TestMethod()> _
    Public Sub IsFiringGridTest()
        Dim PlayerNum As Integer = 1
        Dim IsTrackingGrid As Boolean = False
        Dim IsFiringGrid As Boolean = True
        Dim target As BattleshipGameGrid = New BattleshipGameGrid(PlayerNum, IsTrackingGrid, IsFiringGrid)
        Dim expected As Boolean = True
        Dim actual As Boolean
        target.IsFiringGrid = expected
        actual = target.IsFiringGrid
        Assert.AreEqual(expected, actual)
    End Sub

End Class
